package com.hvgroup.modules.sanic.domain.enums;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.AbstractMap;
import java.util.Arrays;
import java.util.Map;

@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public enum PlatformType {

    DIFY(1, "event"
            , new AbstractMap.SimpleEntry<>("workflow_started", "data:inputs:sys.query")
            , new AbstractMap.SimpleEntry<>("workflow_finished", "data:outputs:answer")
            , new AbstractMap.SimpleEntry<>("data:status", "succeeded")
            , "data:total_tokens"),
    COZE(2, "", null, null, null, "");

    private final Integer value;
    private final String event;
    private final Map.Entry<String, String> nodeStart;
    private final Map.Entry<String, String> nodeFinish;
    private final Map.Entry<String, String> status;
    private final String tokens;

    public static PlatformType findByValue(Integer value) {
        return Arrays.stream(values())
                .filter(e -> e.getValue().equals(value))
                .findFirst()
                .orElseThrow(() -> new RuntimeException("未找到平台!"));
    }

}
